<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
    xmlns:svg="http://www.w3.org/2000/svg"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:ev="http://www.w3.org/2001/xml-events"
    xml:space="preserve">
<head>
    <title/>
</head>
<body>
    <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=12733">bug 12733</a>:
    XPath namespace is attached to a wrong step.</p>
    <div id="result">FAILURE: script did't run</div>
    <svg:g id="r_00"/>
    <script>
        if (window.testRunner)
            testRunner.dumpAsText();

        function nsResolver(prefix) {
            var ns={
                'ev'     : 'http://www.w3.org/2001/xml-events',
                'mathml' : 'http://www.w3.org/1998/Math/MathML',
                'svg'    : 'http://www.w3.org/2000/svg',
                'xhtml'  : 'http://www.w3.org/1999/xhtml',
                'xlink'  : 'http://www.w3.org/1999/xlink'
            };
            return ns[prefix] || null;
        }

        var result = document.evaluate("//svg:g[@id = 'r_00']", document.documentElement, nsResolver, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
        if (result.snapshotLength == 1)
            document.getElementById("result").firstChild.nodeValue = "SUCCESS";
        else
            document.getElementById("result").firstChild.nodeValue = "FAILURE: " + result.snapshotLength + " node(s) matched - should be 1";

        // Remove this node from the document so it doesn't make the DumpRenderTree output
        // different when SVG is enabled and disabled.
        var g = document.getElementsByTagNameNS("http://www.w3.org/2000/svg", "g")[0];
        g.parentNode.removeChild(g);
    </script>

</body>
</html>
